ScriptX includes operators for the following:
Most ScriptX operators give the programmer the option of using white space both before and after the operator. Many programmers prefer to add white space, for readability.z:=x*y -- less readable, but the compiler still understands it
z := x * y -- more readable
ScriptX is permissive about space around operators, with one exception. The subtraction operator ( -
) requires a trailing space. The minus sign without a trailing space is interpreted as the unary operator for negation.
3 - 5 -- with trailing space
-2
3-5 -- without trailing space, the compiler doesn't understand
-- ** "Ill-formed expression" (generalError)
3 +- 5 -- not very readable, but the compiler understands it
-2
3- 5 -- ugly, but the compiler understands it
-2
For a formal treatment of operators, see Appendix A, "ScriptX Reference."
This document is part of the ScriptX Language Guide, one of the volumes of the ScriptX Technical Reference Series. ScriptX is developed by the ScriptX Engineering Team at Apple Computer, successor to the Kaleida Engineering Team at Kaleida Labs, Inc.